#ifndef FILE_CONSTSMALLFILEPROXY_H
#define FILE_CONSTSMALLFILEPROXY_H

#include "utility/Noncopyable.h"

#include <array>
#include <string>

class ConstSmallFileProxy {
public:
    ConstSmallFileProxy() = default;
    virtual ~ConstSmallFileProxy();

    virtual std::uintmax_t file_size() const { return 0; }
    virtual ssize_t read() { return 0; }
    virtual std::string read_no_more_than(std::size_t /*maxSize*/) {
        return {};
    }

private:
    NONCOPYABLE(ConstSmallFileProxy);

};

class BufferConstSmallFileProxy final : public ConstSmallFileProxy {
public:
    explicit BufferConstSmallFileProxy(int fd);
    virtual ~BufferConstSmallFileProxy() override;

    virtual std::uintmax_t file_size() const override;
     virtual ssize_t read() override;
    virtual std::string read_no_more_than(std::size_t maxSize) override;

private:
    NONCOPYABLE(BufferConstSmallFileProxy);
    
    std::array<char, 1 << 16> _buffer;
    const int _fd;
};

#endif